<?php

class Membre {

// <editor-fold defaultstate="collapsed" desc="Champs">
   private $_id = 0;
   private $_nom = "inconnu";
   private $_prenom = "inconnu";
   private $_login = "inconnu";
   private $_pass = "inconnu";
   private $_admin = 0;
   private static $_nbMembres = 0;

// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Propriétés">
   public function __get($propriete) {
      switch ($propriete) {
         case "id": return $this->_id;
            break;
         case "nom": return $this->_nom;
            break;
         case "prenom": return $this->_prenom;
            break;
         case "login": return $this->_login;
            break;
         case "pass": return $this->_pass;
            break;
         case "admin": return $this->_admin;
            break;
      }
   }

   public function __set($propriete, $value) {
      switch ($propriete) {
         case "id":$this->_id = $value;
            break;
         case "nom": $this->_nom = $value;
            break;
         case "prenom": $this->_prenom = $value;
            break;
         case "login": $this->_login = $value;
            break;
         case "pass": $this->_pass = $value;
            break;
         case "admin": $this->_admin = $value;
            break;
      }
   }

// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Constructeur">
   public function Membre($login, $pass, $nom = null, $prenom = null, $admin = null, $id = null) {
      if ($id != null)
         $this->id = $id;
      if ($nom != null)
         $this->nom = $nom;
      if ($prenom != null)
         $this->prenom = $prenom;
      if ($login != null)
         $this->login = $login;
      if ($pass != null)
         $this->pass = $pass;
      if ($admin != null)
         $this->admin = $admin;
      Membre::$_nbMembres++;
   }

// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Méthodes">
   public function __tostring() {
      return $this->nom . ' ' . $this->prenom . '[' . $this->login . ']';
   }

// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="nbMembre">
   public static function getNbMembres() {
      return self::$_nbMembres;
   }

   public function __destruct() {
      Membre::$_nbMembres--;
   }

// </editor-fold>
}

?>
